﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StudentsDB
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        private Group GroupForm;
        private Qualification QualificationForm;
        private Specialization SpecializationForm;
        private Speciality SpecialityForm;
        private Address_Classifier Address_ClassifierForm;
        private void linkHandbooks_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            treeHandbooks.Visible = true;
        }

        private void treeHandbooks_DoubleClick(object sender, EventArgs e)
        {
            if (treeHandbooks.Nodes[0].Nodes[0].IsSelected)
            {
                if (GroupForm == null || GroupForm.IsDisposed)
                {
                    GroupForm = new Group();
                    GroupForm.Show();
                    GroupForm.Activate();
                    return;
                }
                GroupForm.Activate();
            }
            else if (treeHandbooks.Nodes[0].Nodes[1].IsSelected)
            {
                if (QualificationForm == null || QualificationForm.IsDisposed)
                {
                    QualificationForm = new Qualification();
                    QualificationForm.Show();
                    QualificationForm.Activate();
                    return;
                }
                QualificationForm.Activate();
            }
            else if (treeHandbooks.Nodes[0].Nodes[2].IsSelected)
            {
                if (SpecializationForm == null || SpecializationForm.IsDisposed)
                {
                    SpecializationForm = new Specialization();
                    SpecializationForm.Show();
                    SpecializationForm.Activate();
                    return;
                }
                SpecializationForm.Activate();
            }
            else if (treeHandbooks.Nodes[0].Nodes[3].IsSelected)
            {
                if (SpecialityForm == null || SpecialityForm.IsDisposed)
                {
                    SpecialityForm = new Speciality();
                    SpecialityForm.Show();
                    SpecialityForm.Activate();
                    return;
                }
                SpecialityForm.Activate();
            }
        }

        private void AddrClassifer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (Address_ClassifierForm == null || SpecialityForm.IsDisposed)
                {
                    Address_ClassifierForm = new Address_Classifier();
                    Address_ClassifierForm.Show();
                    Address_ClassifierForm.Activate();
                    return;
                }
            Address_ClassifierForm.Activate();
            
        }
    }
}
